Program timing_of_episodes
      dimension nep(5500),nyr(5500),nmon(5500),nstrt(229),nfinis(229),ndy(5500)
!      open(unit=10,file='e:\FIS_duration\episode_data.txt')
!      open(unit=99,file='e:\FIS_duration\episodes_by_month.txt')
      open(unit=10,file='e:\FIS_duration\episode_data_rep.txt')
      open(unit=99,file='e:\FIS_duration\episodes_by_month_rep.txt')
      iend=0
      i=0
1     i=i+1      
      read(10,1000,end=100)nep(i),nyr(i),nmon(i),ndy(i)  
1000  format(1x,i4,10x,i4,i2,i2)  
      if(nyr(i).eq.2023.and.nmon(i).eq.12.and.ndy(i).eq.29) nmon(i)=13
      if(nep(i).eq.nep(1)) go to 1
5     ie=i-1
      nbg=(nyr(1)-2005)*12+nmon(1)
      nend=(nyr(ie)-2005)*12+nmon(ie)
      nstrt(nbg)=nstrt(nbg)+1
      nfinis(nend)=nfinis(nend)+1
      nep(1)=nep(i)
      nyr(1)=nyr(i)
      nmon(1)=nmon(i)
      ndy(1)=ndy(i)
      i=1
      go to 1
100   iend=iend+1
      if(iend.eq.1) go to 5
      kmn=0
      kyr=2005
      do 200 k=1,228
          kmn=kmn+1
          if(kmn.gt.12) kyr=kyr+1
          if(kmn.gt.12) kmn=1
          kdate=kyr*100+kmn
          write(99,9900)kdate,nstrt(k),nfinis(k)
          write(6,9900)kdate,nstrt(k),nfinis(k)
9900      format(1x,i6,2(1x,i4))
200   continue          
      stop
end program timing_of_episodes